<?php
    require_once "config/db.php";

    class MContent extends DB_main
    {
        function return_content($sub_menu_id = NULL, $main_menu_id = NULL)
        {
            if ($sub_menu_id)
            {
                settype($sub_menu_id, 'integer');
            }
            $sql = "SELECT description, keywords, title, created, lastmod, content
            FROM content WHERE id = {$sub_menu_id} AND visible = '1' LIMIT 1";
            if(!$sub_menu_id)
            {
                $sql = "SELECT description, keywords, title, created, lastmod, content
                FROM content
                WHERE sub_menu_id IN (SELECT id FROM sub_menu
                WHERE main_menu_id = {$main_menu_id} AND visible = '1')";
            }
            $result = $this->sql($sql);
            //echo $result;
            return $result;
        }
    }
?>